﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WMSSystem.YSL.Dto.JWT;
using WMSSystem.YSL.Dto.LoginDto;

namespace WMSSystem.YSL.Interfance
{
    /// <summary>
    /// JWT服务接口
    /// </summary>
    public interface IJwtService
    {
        /// <summary>
        /// 生成JWT令牌
        /// 只返回访问令牌字符串
        /// </summary>
        /// <param name="user">用户信息</param>
        /// <returns>JWT访问令牌字符串</returns>
        Task<string> GenerateTokenAsync(LoginResultDto user);

        /// <summary>
        /// 验证JWT令牌
        /// </summary>
        /// <param name="token">JWT令牌</param>
        /// <returns>验证结果</returns>
        Task<bool> ValidateTokenAsync(string token);

        /// <summary>
        /// 刷新JWT令牌
        /// </summary>
        /// <param name="refreshToken">刷新令牌</param>
        /// <returns>新的JWT令牌信息</returns>
        Task<JwtTokenDto> RefreshTokenAsync(string refreshToken);

        /// <summary>
        /// 从令牌中获取用户ID
        /// </summary>
        /// <param name="token">JWT令牌</param>
        /// <returns>用户ID</returns>
        string GetUserIdFromToken(string token);

        /// <summary>
        /// 从令牌中获取用户信息
        /// </summary>
        /// <param name="token">JWT令牌</param>
        /// <returns>用户信息</returns>
        LoginResultDto GetUserFromToken(string token);
    }
}
